#include "fileutils.h"
#include "util/logging.h"
#include <unistd.h>
#include <stdio.h>

/* Global scope */
bool
FU_FileExists ( const char * path )
{
	if ( path == NULL )
		return false;

	return access( path, F_OK | R_OK ) == 0 ? true : false;
}

long
FU_FileSize ( const char * path )
{
	long retvalue = 0;

	FILE * fp = fopen( path, "r" );
	if ( fp == NULL )
	{
		SEx_Errorf( "FILEUTILS: Counldn't fopen(%s)\n", path );
		return retvalue;
	}

	fseek( fp, 0L, SEEK_END );
	retvalue = ftell(fp);
	fclose(fp);

	return retvalue;
}
